package com.boge.modules.shop.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.boge.modules.shop.entity.CattypeEntity;
import com.boge.modules.shop.service.CattypeService;
import com.boge.common.utils.PageUtils;
import com.boge.common.utils.R;



/**
 * 
 *
 * @author boge
 * @email dengpbs@163.com
 * @date 2025-01-18 00:28:29
 */
@RestController
@RequestMapping("shop/cattype")
public class CattypeController {
    @Autowired
    private CattypeService cattypeService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("shop:cattype:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = cattypeService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("shop:cattype:info")
    public R info(@PathVariable("id") Integer id){
		CattypeEntity cattype = cattypeService.getById(id);

        return R.ok().put("cattype", cattype);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("shop:cattype:save")
    public R save(@RequestBody CattypeEntity cattype){
		cattypeService.save(cattype);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("shop:cattype:update")
    public R update(@RequestBody CattypeEntity cattype){
		cattypeService.updateById(cattype);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("shop:cattype:delete")
    public R delete(@RequestBody Integer[] ids){
		cattypeService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
